import request from '@/utils/request'

//用户注册
// post body: { username, password, repassword }
export const userRegisterService = ({ username, password, repassword }) => {
  return request.post('/api/reg', { username, password, repassword })
}
// 用户登录
// post body: { username, password }
export const userLoginService = ({ username, password }) => {
  return request.post('/api/login', { username, password })
}
// 获取用户的基本信息
// get
export const getUserInfoService = () => {
  return request.get('/my/userinfo')
}

// 更新用户信息
// put body: { id,username,nickname, email, user_pic }
export const updateUserInfoService = (data) => {
  return request.put('/my/userinfo', data)
}

// 上传头像
// patch body: { avatar }
export const uploadAvatarService = (avatar) => {
  return request.patch('/my/update/avatar', { avatar })
}

// 重置密码
export const resetPasswordService = (data) => {
  return request.patch('/my/updatepwd', data)
}
